home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 34 / Mac Magazin and MacEasy Magazine CD - Issue 34.iso / Office / trueTools / spider / spider / stack.txt < prev    next >
Text File  |  1997-05-31  |  8KB  |  257 lines

  1. -- stack: in
  2. -- format: 10 (HyperCard 2)
  3. -- flags: 0x1000 (none)
  4. -- protect password hash: 0
  5. -- maximum user level: 5 (scripting)
  6. -- window: Rect(x1=128, y1=119, x2=288, y2=191)
  7. -- screen: Rect(x1=0, y1=0, x2=512, y2=384)
  8. -- card dimensions: w=160 h=72
  9. -- scroll: x=0 y=0
  10. -- background count: 1
  11. -- first background id: 2633
  12. -- card count: 1
  13. -- first card id: 2879
  14. -- list block id: 2248
  15. -- print block id: 0
  16. -- font table block id: 3530
  17. -- style table block id: 3194
  18. -- free block count: 0
  19. -- free size: 0 bytes
  20. -- total size: 11168 bytes
  21. -- stack block size: 7168 bytes
  22. -- created by hypercard version: 0x02308000
  23. -- compacted by hypercard version: 0x02358000
  24. -- modified by hypercard version: 0x02358000
  25. -- opened by hypercard version: 0x02358000
  26. -- patterns[0]: 0x0000000000000000
  27. -- patterns[1]: 0x8000000008000000
  28. -- patterns[2]: 0x8800220088002200
  29. -- patterns[3]: 0x8888222288882222
  30. -- patterns[4]: 0x88AA22AA88AA22AA
  31. -- patterns[5]: 0xCCAA33AACCAA33AA
  32. -- patterns[6]: 0xEEAABBAAEEAABBAA
  33. -- patterns[7]: 0xEEBBBBEEEEBBBBEE
  34. -- patterns[8]: 0xFFBBFFEEFFBBFFEE
  35. -- patterns[9]: 0xFFBBFFFFFFBBFFFF
  36. -- patterns[10]: 0x8010022001084004
  37. -- patterns[11]: 0xFFFFFFFFFFFFFFFF
  38. -- patterns[12]: 0x8822882288228822
  39. -- patterns[13]: 0x1122448811224488
  40. -- patterns[14]: 0xC4800C6843023026
  41. -- patterns[15]: 0xB130031BD8C00C8D
  42. -- patterns[16]: 0xAA00AA00AA00AA00
  43. -- patterns[17]: 0x8822552288225522
  44. -- patterns[18]: 0x8855225588552255
  45. -- patterns[19]: 0x77DD77DD77DD77DD
  46. -- patterns[20]: 0x8000000000000000
  47. -- patterns[21]: 0xAA55AA55AA55AA55
  48. -- patterns[22]: 0x038448300C020101
  49. -- patterns[23]: 0x8244394482010101
  50. -- patterns[24]: 0x8814224188412214
  51. -- patterns[25]: 0x8080413E080814E3
  52. -- patterns[26]: 0x22048C7422179810
  53. -- patterns[27]: 0xBE808808EB088880
  54. -- patterns[28]: 0x25C8328964244C92
  55. -- patterns[29]: 0xA29C41BE2AC914EB
  56. -- patterns[30]: 0x40A00000040A0000
  57. -- patterns[31]: 0x8040200002040800
  58. -- patterns[32]: 0xAA00800088008000
  59. -- patterns[33]: 0xFF80808080808080
  60. -- patterns[34]: 0x081C22C180010204
  61. -- patterns[35]: 0xFF808080FF080808
  62. -- patterns[36]: 0xF87422478F172271
  63. -- patterns[37]: 0xBF00BFBFB0B0B0B0
  64. -- patterns[38]: 0xFF7FBE5DA2418000
  65. -- patterns[39]: 0xFAF5FAF5A050A050
  66. -- checksum: 0xDF7BBD70
  67. ----- HyperTalk script -----
  68. on controlKey key
  69.   if key is 23 and short name of this stack ‚↠spider then -- w
  70.     put the optionKey is down into o
  71.     if o then
  72.       answer "Weave all cards of this Stack ?" with "Cancel","Weave"
  73.       if it is "Cancel" then exit controlKey  --‚àÜ
  74.     end if
  75.     weaveStack not o
  76.     if the result is not empty then
  77.       answer the result
  78.     end if
  79.   else pass controlKey
  80. end controlKey
  81.  
  82. on weaveStack cardOnly
  83.   set cursor to busy
  84.   if the version < 2.3 then
  85.     return "Sorry, weaving requires HyperCard (Player) 2.3 or later."  --‚àÜ
  86.   end if
  87.   --
  88.   if ":truePrint" & return is not in the stacksInUse then
  89.     start using stack "truePrint"
  90.     if the result is not empty then
  91.       return "Sorry, weaving requires the truePrint stack."  --‚àÜ
  92.     end if
  93.   end if
  94.   --
  95.   lock screen
  96.   lock messages
  97.   go stack "spider"
  98.   if hilite of btn "Mac" then put return into break
  99.   else if hilite of btn "Unix" then put numToChar(10) into break
  100.   else put return & numToChar(10) into break
  101.   go back
  102.   unlock messages
  103.   unlock screen
  104.   --
  105.   put (value of word 2 of long name of this stack) && "Δí:" into destinationFolder
  106.   if there is no folder destinationFolder then
  107.     createFolder(destinationFolder)
  108.     if the result is not empty then
  109.       return "Could not create output folder." & return & "CreateFolder" && the result  --‚àÜ
  110.     end if
  111.   end if
  112.   --
  113.   if cardOnly then
  114.     weaveCard destinationFolder, break
  115.     if the result is not empty then
  116.       return the result  --‚àÜ
  117.     end if
  118.   else
  119.     go to first card
  120.     repeat for the number of cards
  121.       if the mouse is down then exit repeat  --‚àÜ
  122.       weaveCard destinationFolder, break
  123.       if the result is not empty then return the result  --‚àÜ
  124.       go next card
  125.     end repeat
  126.   end if
  127. end weaveStack
  128.  
  129.  
  130. on weaveCard destinationFolder, break
  131.   --
  132.   put weaveCardName() into cName
  133.   put script of this card into sc
  134.   put word 2 of sc into ext
  135.   if ext‚â†"jpeg" and ext‚â†"gif" then put "gif" into ext
  136.   put word 3 of sc into quality
  137.   if ext is "jpeg" then
  138.     if quality‚â†"very low" and quality‚â†"low" and quality‚â†"normal" and quality ‚â†"high" and quality‚â†"very high" then
  139.       put "normal" into quality
  140.     end if
  141.   else put quality ‚↠"noninterlaced" into interlace
  142.   --
  143.   lock screen
  144.   lock messages
  145.   put empty into list
  146.   repeat with i=the number of cd parts down to 1
  147.     if visible of cd part i then
  148.       set cursor to busy
  149.       put empty into x
  150.       put long name of this card into a
  151.       put long name of this stack into s
  152.       send mouseUp to cd part i
  153.       if long name of this card ‚↠a then
  154.         if long name of this stack is s then
  155.           put weaveCardName() & ".html" into x
  156.         end if
  157.         go back
  158.       else if the result is not empty then
  159.         put the result into x
  160.       end if
  161.       if x is not empty then
  162.         put x && rect of cd part i & return after list
  163.       end if
  164.     end if
  165.   end repeat
  166.   --
  167.   repeat with i=the number of bg parts down to 1
  168.     if visible of bg part i then
  169.       set cursor to busy
  170.       put empty into x
  171.       put long name of this card into a
  172.       put long name of this stack into s
  173.       send mouseUp to bg part i
  174.       if long name of this card ‚↠a then
  175.         if long name of this stack is s then
  176.           put weaveCardName() & ".html" into x
  177.         end if
  178.         go back
  179.       else if the result is not empty then
  180.         put the result into x
  181.       end if
  182.       if x is not empty then
  183.         put x && rect of bg part i & return after list
  184.       end if
  185.     end if
  186.   end repeat
  187.   unlock messages
  188.   unlock screen
  189.   --
  190.   set cursor to busy
  191.   put destinationFolder & cName & ".html" into f
  192.   open file f
  193.   --
  194.   write "<HTML>" & break & break & "<HEAD>" & break & "<TITLE>" & short name of this card & "</TITLE>" & break & "</HEAD>" & break & break to file f
  195.   --
  196.   write "<BODY BGCOLOR=" & quote & "#FFFFFF" & quote & ">" & break & break to file f
  197.   --
  198.   write "<A HREF=" & quote & cName & ".map" & quote & ">" & "<IMG SRC=" & quote & cName & "." & ext & quote && "HEIGHT=" & height of card window && "WIDTH=" & width of card window & break & "USEMAP=" & quote & "#map" & quote && "ISMAP BORDER=0></A>" & break & break to file f
  199.   --
  200.   write "<MAP NAME=" & quote & "map" & quote & ">" & break to file f
  201.   repeat with i=1 to the number of lines of list
  202.     write "<AREA SHAPE=" & quote & "rect" & quote && "COORDS=" & quote & word 2 of line i of list & quote && "HREF=" & quote & word 1 of line i of list & quote & ">" & break to file f
  203.   end repeat
  204.   write "</MAP>" & break & break to file f
  205.   write "</BODY>" & break & break & "</HTML>" & break to file f
  206.   --
  207.   close file f
  208.   --
  209.   put destinationFolder & cName & ".map" into f
  210.   open file f
  211.   repeat with i=1 to the number of lines of list
  212.     write "rect" && word 1 of line i of list && item 1 to 2 of word 2 of line i of list && item 3 to 4 of word 2 of line i of list & break to file f
  213.   end repeat
  214.   close file f
  215.   --
  216.   set cursor to busy
  217.   put trueScreenshot() into f
  218.   if word one of f is not "ok" then
  219.     return "Could not take screenshot." & return & f  --‚àÜ
  220.   end if
  221.   delete word one of f
  222.   --
  223.   set cursor to busy
  224.   put "tell application" && quote & "clip2gif" & quote & return into s
  225.   --
  226.   put "save file" && quote & f & quote && "as " after s
  227.   if ext is "jpeg" then put "JPEG" after s
  228.   else put "GIF" after s
  229.   --
  230.   put " in file" && quote & destinationFolder & cName & "." & ext & quote after s
  231.   put " crop {" && rect of card window && "}" after s
  232.   if ext is "jpeg" then put " quality" && quality after s
  233.   --
  234.   put " depth 8 transparency no scale 100" && "colors palette input colors" after s
  235.   if ext is "gif" then put " interlacing" && interlace after s
  236.   put  return & "end tell" after s
  237.   --
  238.   if the optionKey is down then answer s
  239.   do s as AppleScript
  240.   --
  241.   set cursor to busy
  242.   eraseFile f
  243.   if the result is not empty then
  244.     return "Could not erase screen shot." & return & "eraseFile" && the result  --‚àÜ
  245.   end if
  246. end weaveCard
  247.  
  248. function weaveCardName
  249. put short name of this card into a
  250. put empty into cName
  251. repeat with i=1 to the number of words of a
  252.   put word i of a after cName
  253. end repeat
  254. return cName
  255. end weaveCardName
  256.  
  257.